/**
 * 
 */
package jvs.peer.io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;

import jvs.peer.FileObject;


/**
 * @author qiangli
 *
 */
public class File implements FileObject, info.niwota.vfs.smack.File {

	protected java.io.File file = null;

	public File(String path) {
		file = new java.io.File(path);
	}
	
	public File(java.io.File file) {
		this.file = file;
	}

	public static final int BUFSIZE = 1024;

	public boolean canRead() {
		return file.canRead();
	}

	public boolean canWrite() {
		return file.canWrite();
	}

	public String getPath() {
		return file.getPath();
	}

	public boolean isDirectory() {
		return file.isDirectory();
	}

	public boolean isFile() {
		return file.isFile();
	}

	public long lastModified() {
		return file.lastModified();
	}

	public long length() {
		return file.length();
	}

	public String getName() {
		return file.getName();
	}

	public boolean exists() {
		return file.exists();
	}

	public boolean canExecute() {
		return false;
	}

	public InputStream getInputStream() throws FileNotFoundException {
		return new FileInputStream(file);
	}

	public OutputStream getOutputStream() throws FileNotFoundException {
		return new FileOutputStream(file);
	}

}
